home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
lzrtpu.zip
/
SHADETXT.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1990-10-19
|
2KB
|
72 lines
program Shadetxt;
Uses
laserprt;
{====================================================================
Demonstrates how to write shaded text from a Pascal program to an
HP LaserJet.
Author: Ted Dickens, HP Forum
Compuserve ID [76701,272]
Modified by: Bob Smedley
72331,3615
Note that area fills progress down and to the right of the current
cursor location, and that the next character cell to be printed uses
the current cursor location as the bottom left corner.
Thus we proceed by shading the line before we print on it. And since
the text will appear ABOVE the cursor, while shading appears BELOW the
cursor, we move the cursor UP before executing the shading, then back
before writing the text.
=======================================================================}
CONST
lineheight = 1.0/6.0; {printing using 6 lines per inch}
linewidth = 8.0; {print area is 8"}
VAR
lpt : text;
i : word;
PROCEDURE SetBoxSize(x,y:real);
BEGIN{setboxsize}
WRITE(lpt,ShadeWidth(720.0*x)+ShadeHeight(720.0*y));
END;{setboxsize}
PROCEDURE SetShading(p:integer);
BEGIN{setshading}
WRITE(lpt,ShadePercent(p));
END;{setshading}
PROCEDURE ShadeFillArea;
BEGIN{shadefillarea}
WRITE(lpt,UpY(90.0,decipoints)); {move cursor up 90 decipoints}
WRITE(lpt,PrintShade); {shade the line}
WRITE(lpt,DownY(90.0,decipoints)); {move cursor back to its
original spot}
END;{shadefillarea}
BEGIN{main}
ASSIGN(lpt,'PRN');
REWRITE(lpt);
WRITE(lpt,ResetLaser); {Reset printer}
{note also use of write instead of writeln,
this prevents printer buffer from being filled
with a LF/CR}
SetBoxSize(linewidth,lineheight);
SetShading(20); {20% shading}
FOR i := 1 to 20 DO
BEGIN
ShadeFillArea;
WRITELN(lpt,'This is a shaded line of text.');
WRITELN(lpt,'This is an unshaded line of text.');
END;
WRITE(lpt,formfeed); {Eject page}
CLOSE(lpt);
END.